<?php
if(!isset($_SESSION)){session_start();};
require_once('core.php');
if(!isset($_SESSION)){session_start();};
$uploaddir = './uploads/'; 
$ext = substr($_FILES['uploadfile']['name'],strpos($_FILES['uploadfile']['name'],'.'));
$filename = $_FILES['uploadfile']['name']=time().$ext;
$file = $uploaddir . basename($filename); 

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { 
	cropImage($file, $uploaddir.'thumb-'.$filename, 64);
	$_SESSION['CURRENT_IMG'][] = 'thumb-' . $filename;
	echo "success,".$filename; 
} else {
	echo "error";
}

?>